//
//  BaseNavigationViewController.m
//  魔兽大数据
//
//  Created by 王右 on 2017/10/24.
//  Copyright © 2017年 王右. All rights reserved.
//

#import "BaseNavigationViewController.h"



@interface BaseNavigationViewController ()



@end

@implementation BaseNavigationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    
    if (self.viewControllers.count > 0) {
        viewController.hidesBottomBarWhenPushed = YES;
        self.navigationBarHidden=NO;
    }
    [super pushViewController:viewController animated:animated];
}

- (UIViewController *)popViewControllerAnimated:(BOOL)animated{
    if (self.viewControllers.count == 2) {
        UIViewController *viewController = (UIViewController *)[self.viewControllers firstObject];
        viewController.hidesBottomBarWhenPushed = NO;
        if (![viewController isKindOfClass:NSClassFromString(@"OnReviewHomeViewController")]) {
            self.navigationBarHidden=YES;
        }
    }
    return [super popViewControllerAnimated:animated];
}

+(void)initialize {
    [[UINavigationBar appearance] setTintColor:[UIColor colorWithHexString:@"#999999"]];
    [[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]];
    [[UINavigationBar appearance] setTitleTextAttributes: @{NSForegroundColorAttributeName:[UIColor blackColor],NSFontAttributeName:[UIFont boldSystemFontOfSize:18]}];
    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-SCREEN_WIDTH, 0) forBarMetrics:UIBarMetricsDefault];
}

- (void)backAction{
    [self popViewControllerAnimated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
